// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.iso.weather.fx;

import zombie.core.textures.Texture;

public class CloudParticle extends WeatherParticle {
    private double angleRadians = 0.0;
    private float lastAngle = -1.0F;
    private float lastIntensity = -1.0F;
    protected float angleOffset = 0.0F;
    private float alphaMod = 0.0F;
    private float tmpAngle = 0.0F;

    public CloudParticle(Texture texture) {
        super(texture);
    }

    public CloudParticle(Texture texture, int w, int h) {
        super(texture, w, h);
    }

    @Override
    public void update(float delta) {
        if (this.lastAngle != IsoWeatherFX.instance.windAngleClouds || this.lastIntensity != IsoWeatherFX.instance.windIntensity.value()) {
            this.tmpAngle = IsoWeatherFX.instance.windAngleClouds;
            if (this.tmpAngle > 360.0F) {
                this.tmpAngle -= 360.0F;
            }

            if (this.tmpAngle < 0.0F) {
                this.tmpAngle += 360.0F;
            }

            this.angleRadians = Math.toRadians((double)this.tmpAngle);
            this.velocity.set((float)Math.cos(this.angleRadians) * this.speed, (float)Math.sin(this.angleRadians) * this.speed);
            this.lastAngle = IsoWeatherFX.instance.windAngleClouds;
        }

        this.position.x = this.position.x + this.velocity.x * IsoWeatherFX.instance.windSpeedFog * delta;
        this.position.y = this.position.y + this.velocity.y * IsoWeatherFX.instance.windSpeedFog * delta;
        super.update(delta);
        this.alphaMod = IsoWeatherFX.instance.cloudIntensity.value() * 0.3F;
        this.renderAlpha = this.alpha * this.alphaMod * this.alphaFadeMod.value() * IsoWeatherFX.instance.indoorsAlphaMod.value();
    }
}
